import 'package:flutter/material.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';
import 'package:get/get.dart';
import 'package:kq_flutter_core_widget/widgets/button/kq_ink_well.dart';
import 'package:kq_flutter_widgets/resources/kq_theme_colors.dart';
import 'package:kq_flutter_widgets/widgets/titleBar/kq_title_bar.dart';

import '../../router/route_map.dart';

class AnimateDemo extends StatelessWidget {
  const AnimateDemo({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: KqHeadBar(
        headTitle: '动画相关控件演示',
        back: () {
          Get.back();
        },
      ),
      body: GridView.count(
        crossAxisCount: 2,
        scrollDirection: Axis.vertical,
        //宽高比
        childAspectRatio: 3 / 1.2,
        padding: EdgeInsets.all(12.r),
        mainAxisSpacing: 12.r,
        crossAxisSpacing: 12.r,
        children: [
          gridMenuItem('科强首页动画', () {
            RouteMap.pushKqAnimateDemo();
          }),
          gridMenuItem('KqAnimateView 动画', () {
            RouteMap.pushAnimateViewDemo();
          }),
          gridMenuItem('StackViewDemo', () {
            RouteMap.pushStackViewDemo();
          }),
          gridMenuItem('MapChart演示', () {
            RouteMap.pushMapChartChooseDemo();
          }),
          gridMenuItem('粒子 演示', () {
            RouteMap.pushParticleDemo();
          }),
          gridMenuItem('拖尾 演示', () {
            RouteMap.pushTrailingDemo();
          }),
          gridMenuItem('绘制测试 演示', () {
            Get.toNamed("/DrawPathTest");
          }),
        ],
      ),
    );
  }

  /// 菜单布局
  Widget gridMenuItem(String menuName, GestureTapCallback? onTap) {
    return KqInkWell(
      radius: 20.r,
      borderWidth: 2,
      borderColor: Colors.red,
      onTap: onTap,
      child: Container(
        color: KqThemeColors.bgWhite,
        padding: EdgeInsets.all(10.r),
        child: Text(
          menuName,
          style: TextStyle(
            fontWeight: FontWeight.bold,
            color: Colors.black,
            fontSize: 20.sp,
          ),
        ),
      ),
    );
  }
}
